<?php
namespace Admin\Model;
use Think\Model;

class AttrkeyModel extends Model{
  // protected $tableName = 'attrkey';
  protected $_auto = array(
    array('ctime','time',1,'function'),);
   
  protected $_validate = array(
    array('kname','require','标题不能空！'),
    array('gid,kname','','数据已经存在！',1,'unique',1),
  	);

  public function info($id, $field = true){
        /* 获取分类信息 */
        $map = array();
        if(is_numeric($id)){ //通过ID查询
            $map['id'] = $id;
        } else { //通过标识查询
            $map['name'] = $id;
        }
        return $this->field($field)->where($map)->find();
    }
 


}


?>